// 官方题解
#include <bits/stdc++.h>

using namespace std;

int main() {
  int n, m;
  cin >> n >> m;
  vector<string> vote(n);
  // string  vote[100000];
  for (int i = 0; i < n; i++) {
    cin >> vote[i];
  }

  vector<int> point(n, 0);//统计每一个投票人的积分

  for (int j = 0; j < m; j++) {//枚举每一轮
    int x = 0, y = 0;  //  投个0号的有x人， 投给1号有y人
    for (int i = 0; i < n; i++) {
      if (vote[i][j] == '0') {  
        x++;
      } else { 
        y++;
      }
    }
    for (int i = 0; i < n; i++) {
      if (vote[i][j] == '0') {
        point[i] +=  (  x<=y);        
      } else {        
          point[i] += ( x>=y );
         
      }
    }
  }

  int high = (*max_element(point.begin(), point.end()));


  for (int i = 0; i < n; i++) {
    if (point[i] == high) {
      cout << i + 1 << " ";
    }
  }
  cout << "\n";
  return 0;
}
